<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:mo="https://gitee.com/aun/Timo">
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
</head>
<body class="timo-layout-page">
    <div class="layui-card">
        <div class="layui-card-header timo-card-header">
            <span><i class="fa fa-bars"></i> 任务触发查询 </span>
            <i class="layui-icon layui-icon-refresh refresh-btn"></i>
        </div>
        <div class="layui-card-body">
            <div class="layui-row timo-card-screen">
                <div class="pull-left layui-form-pane timo-search-box">
                    <div class="layui-inline">
                        <label class="layui-form-label">应用</label>
                        <div class="layui-input-block timo-search-data">
                            <select name="appId" class="timo-search-select" th:value="${param?.appId}">
                                <option value="">全部</option>
                                <option th:each="item:${apps}" th:text="${item.appName}" th:value="${item.id}" th:selected="${item.id == param?.appId}"></option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">任务</label>
                        <div class="layui-input-block timo-search-data">
                            <select name="jobId" class="timo-search-select" th:value="${param?.jobId}">
                                <option value="">全部</option>
                                <option th:each="item:${jobs}" th:text="${item.jobName}" th:value="${item.id}" th:selected="${item.id == param?.jobId}"></option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">起始时间</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="laydate1" name="startTime" placeholder="yyyy-MM-dd" th:value="${param?.startTime}">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">结束时间</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="laydate2" name="endTime" placeholder="yyyy-MM-dd" th:value="${param?.endTime}">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn timo-search-btn">
                            <i class="fa fa-search"></i>
                        </button>
                    </div>
                </div>
            </div>
            <div class="timo-table-wrap">
                <table class="layui-table timo-table">
                    <thead>
                    <tr>
                        <th class="sortable" data-field="ID">Id</th>
                        <th class="sortable" data-field="JOB_ID">任务名称</th>
                        <th class="sortable" data-field="TRIGGER_RESULT_CODE">触发结果</th>
                        <th class="sortable" data-field="TRIGGER_RESULT_MESSAGE">信息</th>
                        <th class="sortable" data-field="TRIGGER_TIME">触发时间</th>
                        <th class="sortable" data-field="TRIGGER_END_TIME">结束时间</th>
                        <th>详细信息</th>
                        <th>执行主机</th>
                        <th>任务分片信息</th>
                        <th>集群任务处理</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="item:${list}">
                        <td th:text="${item.ID}">Id</td>
                        <td th:text="${item.JOB_NAME}">任务名称</td>
                        <td>
                            <span th:text="${#dicts.keyValue('TRIGGER_RESULT', item.TRIGGER_RESULT_CODE)}" th:classappend="${item.TRIGGER_RESULT_CODE ne 'T-0000'} ? 'layui-btn layui-btn-sm layui-btn-danger'"></span>
                        </td>
                        <td th:text="${item.TRIGGER_RESULT_MESSAGE != null && #strings.length(item.TRIGGER_RESULT_MESSAGE) > 20 ? #strings.substring(item.TRIGGER_RESULT_MESSAGE,0,20) + '...' : item.TRIGGER_RESULT_MESSAGE}">信息</td>
                        <td th:text="${#dates.format(item.TRIGGER_TIME, 'yyyy-MM-dd HH:mm:ss')}">创建时间</td>
                        <td th:text="${#dates.format(item.TRIGGER_END_TIME, 'yyyy-MM-dd HH:mm:ss')}">更新时间</td>
                        <td>
                            <a class="open-popup" data-title="详细信息" th:attr="data-url=@{'/admin/quartz/job/trigger/info/'+${item.ID}}"  data-size="1200,700" href="#">详细信息</a>
                        </td>
                        <td>
                            <a class="open-popup" data-title="执行主机" th:attr="data-url=@{'/admin/quartz/job/trigger/execute/'+${item.ID}}"  data-size="1300,750" href="#">执行主机</a>
                        </td>
                        <td >
                            <a class="open-popup" data-title="分片信息" th:if="${item.simpleTriggerName eq 'PARTITION_TASK_TRIGGER'}" th:attr="data-url=@{'/admin/quartz/job/trigger/partitionLogList/'+${item.ID}}"  data-size="1300,750" href="#">分片信息</a>
                        </td>
                        <td >
                            <a class="open-popup" data-title="集群结果处理" th:if="${item.EXECUTE_MODEL eq 'CLUSTER'}" th:attr="data-url=@{'/admin/quartz/job/trigger/collectLogList/'+${item.ID}}"  data-size="1300,750" href="#">集群结果处理</a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div th:replace="/common/fragment :: page"></div>
        </div>
    </div>
<script th:replace="/common/template :: script"></script>
    <script type="text/javascript" th:src="@{/js/triggerLog.js}"></script>
</body>
</html>